package edu.qust.service.serviceimpl;


import edu.qust.domain.Admin;
import edu.qust.mapper.AdminMapper;
import edu.qust.service.AdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.servlet.http.HttpSession;
import java.util.List;

@Service
public class IAdminService implements AdminService {
   @Autowired
    private AdminMapper adminMapper;

    @Override
    public String login(Admin adm, HttpSession session) {
        String a="";
        List<Admin> adminList=null;
        try{
            adminList =adminMapper.findAdmin(adm);
        }catch (Exception e){
            System.out.println("数据访问异常");
        }
        if (adminList.size()>0){
            session.setAttribute("loginadm",adminList.get(0));
            a="loginsuccess";
        }else{
            a="loginerror";
        }
        return a;
    }
}
